
let mNodes = []

module.exports = {

    clear()
    {
        for (let v of mNodes)
        {
            v.destroy()
        }
        mNodes.splice(0, mNodes.length)
    },

    push(node)
    {
        if (node)
        {
            node.scale   = 1
            node.opacity = 255

            node.stopAllActions()

            node.removeAllChildren(true)

            node.removeFromParent(false)

            mNodes.push(node)
        }
    },

    pop(parent, group)
    {
        let node = null

        let len = mNodes.length
        if (len > 0)
        {
            --len
            node = mNodes[len]

            mNodes.splice(len, 1)

            node.zIndex   = 0

            node.angle    = 0
            node.x        = 0
            node.y        = 0
            node.scale    = 1
        }
        else
        {
            node = new cc.Node()
        }

        if (parent)
        {
            node.parent = parent
        }

        return node
    }
}

